# cmake ..
# cmake --build .
# ctest

cmake_minimum_required(VERSION 3.15)
project(CAD VERSION 1.0)

# 指定C++标准
add_library(CAD_compiler_flags INTERFACE)
target_compile_features(CAD_compiler_flags INTERFACE cxx_std_17)

# 构建此项目时添加编译器警告标志
set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>")
set(msvc_cxx "$<COMPILE_LANG_AND_ID:CXX,MSVC>")
target_compile_options(CAD_compiler_flags INTERFACE
  "$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused>>"
  "$<${msvc_cxx}:$<BUILD_INTERFACE:-W3>>"
)

# 配置头文件以将一些 CMake 设置传递给源代码
configure_file(CADConfig.h.in CADConfig.h)

# 添加各模块的库
add_subdirectory(3rd)
add_subdirectory(Src)
add_subdirectory(UnitTests)


# 输出路径
#set(EXECUTABLE_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/Bin")
#set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/Bin/lib")
